home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / a_man / cat7 / pciba.z / pciba
Text File  |  1998-10-20  |  18KB  |  331 lines

  1.  
  2.  
  3.  
  4. PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))                                                            PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      pciba - User level PCI Bus Adapter interface.
  10.  
  11. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  12.      The _p_c_i_b_a interface provides a mechanism to access the PCI bus address
  13.      spaces, route PCI interrupts, and obtain PCI addresses for DMA from user
  14.      programs.  It is intended to provide a convenient mechanism for writing
  15.      user level PCI device drivers.
  16.  
  17.    AAAAccccttttiiiivvvvaaaattttiiiinnnngggg tttthhhheeee ppppcccciiiibbbbaaaa ddddrrrriiiivvvveeeerrrr
  18.      The device driver that provides _p_c_i_b_a services is a loadable device
  19.      driver, which may or may not be automatically loaded during the boot of
  20.      your system.  The simplest way to find out if this driver is active in
  21.      your system is to check the list of currently registered device drivers:
  22.  
  23.           _%%%% _mmmm_llll _llll_iiii_ssss_tttt _|||| _gggg_rrrr_eeee_pppp _pppp_cccc_iiii_bbbb_aaaa
  24.  
  25.      If there is no output, then the driver is not present and must be loaded
  26.      before use.  To load the driver:
  27.  
  28.           _#### _llll_bbbb_oooo_oooo_tttt _----_LLLL _pppp_cccc_iiii_bbbb_aaaa
  29.  
  30.      If the driver is not active for a while, the system will keep it
  31.      registered but remove it from memory, reloading the driver when it is
  32.      again needed.  You can explicitly remove the driver from the system:
  33.  
  34.           _#### _mmmm_llll _llll_iiii_ssss_tttt _|||| _aaaa_wwww_kkkk _''''_////_pppp_cccc_iiii_bbbb_aaaa_//// _{{{{ _pppp_rrrr_iiii_nnnn_tttt_ffff _""""_llll_bbbb_oooo_oooo_tttt _----_UUUU _%%%%_dddd_\\\\_nnnn_""""_,,,, _$$$$_2222_;;;; _}}}}_'''' _|||| _ssss_hhhh
  35.  
  36.    FFFFiiiinnnnddddiiiinnnngggg yyyyoooouuuurrrr ddddeeeevvvviiiicccceeee uuuunnnnddddeeeerrrr ////hhhhwwww
  37.      When the system boots, it builds a graph of all devices within the
  38.      system; later, that graph is made available as a filesystem at the _////_hhhh_wwww
  39.      mount point.
  40.  
  41.      Knowing the PCI ID word from your device, you can find where it sits
  42.      under _////_hhhh_wwww fairly quickly by looking in one central location. There is a
  43.      directory
  44.  
  45.           _////_hhhh_wwww_////_...._iiii_dddd_////_pppp_cccc_iiii_////_I_D_W_O_R_D_////
  46.  
  47.      where IDWORD is replaced by the eight-digit hexidecimal value from the ID
  48.      word.  For instance, look in the directory
  49.  
  50.           _////_hhhh_wwww_////_...._iiii_dddd_////_pppp_cccc_iiii_////_1111_0000_AAAA_9999_0000_0000_0000_3333_////
  51.  
  52.      to find all the instances of SGI's standard IOC3 chip, which uses VENDOR
  53.      0x10A9 and DEVICE 0x0003.
  54.  
  55.      Inside this directory you will find symbolic links to the real locations
  56.      within _////_hhhh_wwww where your device has been found.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))                                                            PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))
  71.  
  72.  
  73.  
  74.    IIIIOOOOCCCCTTTTLLLL SSSSeeeerrrrvvvviiiicccceeeessss
  75.      Vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_cccc_oooo_nnnn_ffff_iiii_gggg supports the following ioctl commands:
  76.  
  77.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_CCCC_FFFF_GGGG_RRRR_DDDD(type, register) - read a config register
  78.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_CCCC_FFFF_GGGG_WWWW_RRRR(type, register) - write a config register
  79.  
  80.           In these macros, type is the data type being moved around (generally
  81.           char, short or int) and register is the byte offset within the
  82.           configuration space, generally obtained by using a macro supplied
  83.           from the _<<<<_ssss_yyyy_ssss_////_PPPP_CCCC_IIII_////_PPPP_CCCC_IIII______dddd_eeee_ffff_ssss_...._hhhh_>>>> header file.  Some registers that are
  84.           commonly accessed are wrapped up into single macros:
  85.  
  86.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_GGGG_EEEE_TTTT_IIII_DDDD - read slot's PCI Identification register.
  87.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_SSSS_EEEE_TTTT_CCCC_MMMM_DDDD - write slot's PCI Command register.
  88.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_GGGG_EEEE_TTTT_RRRR_EEEE_VVVV - read slot's PCI Device Revision register.
  89.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_GGGG_EEEE_TTTT_HHHH_TTTT_YYYY_PPPP_EEEE - read slot's PCI Device Header Type register
  90.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_GGGG_EEEE_TTTT_BBBB_AAAA_SSSS_EEEE(n) - read slot's PCI BASE(n) register.
  91.  
  92.      Vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_dddd_mmmm_aaaa supports the following ioctl commands:
  93.  
  94.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_DDDD_MMMM_AAAA_AAAA_LLLL_LLLL_OOOO_CCCC - Allocate a buffer for User DMA.
  95.           The parameter should be a pointer to a 64-bit variable containing
  96.           either simply the size of the transfer, or the result of packing
  97.           some PCIIO DMA flags with the size using the
  98.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_DDDD_MMMM_AAAA_AAAA_LLLL_LLLL_OOOO_CCCC______RRRR_EEEE_QQQQ_UUUU_EEEE_SSSS_TTTT______PPPP_AAAA_CCCC_KKKK(flags, size) macro (which just places
  99.           the flags in the upper 32 bits of the value). All blocks allocated
  100.           with _PPPP_CCCC_IIII_IIII_OOOO_CCCC_DDDD_MMMM_AAAA_AAAA_LLLL_LLLL_OOOO_CCCC should be explicitly released with _PPPP_CCCC_IIII_IIII_OOOO_CCCC_DDDD_MMMM_AAAA_FFFF_RRRR_EEEE_EEEE
  101.           before the device is closed, after making sure that there is no
  102.           longer any outstanding DMA to the target.
  103.  
  104.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_DDDD_MMMM_AAAA_FFFF_RRRR_EEEE_EEEE - Destroy a User DMA buffer.
  105.           The parameter is a pointer to a 64-bit variable containing the PCI
  106.           address of a DMA buffer previously allocated by a _PPPP_CCCC_IIII_IIII_OOOO_CCCC_DDDD_MMMM_AAAA_AAAA_LLLL_LLLL_OOOO_CCCC
  107.           request.
  108.  
  109.      Vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_iiii_nnnn_tttt_rrrr supports the following ioctl commands:
  110.  
  111.           _PPPP_CCCC_IIII_IIII_OOOO_CCCC_SSSS_EEEE_TTTT_UUUU_LLLL_IIII(n) - set up a ULI
  112.           The value n in the command is a bitmap of which interrupts are to be
  113.           routed from the board, formed as the inclusive-or of one or more
  114.           PCIIO_INTR_LINE macros.  The parameter is a pointer to a _ssss_tttt_rrrr_uuuu_cccc_tttt
  115.           _uuuu_llll_iiii_aaaa_rrrr_gggg_ssss appropriately filled in.
  116.  
  117.    MMMMeeeemmmmoooorrrryyyy MMMMaaaappppppppiiiinnnngggg SSSSeeeerrrrvvvviiiicccceeeessss
  118.      Memory mapping vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_bbbb_aaaa_ssss_eeee_////bar returns a pointer that
  119.      can be used to initiate PIO access to the PCI space and offset that the
  120.      system expects the PCI device in _s_l_o_t to decode with its BASE address
  121.      register _b_a_r.  One such node is created for each BASE register that the
  122.      system observes and sets up.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))                                                            PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))
  137.  
  138.  
  139.  
  140.      Memory mapping vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_mmmm_eeee_mmmm returns a pointer similar to
  141.      the _b_a_r case above for the first BASE register that decodes PCI MEM
  142.      space.  If no BASE registers on this device decode PCI MEM space, this
  143.      vertex will not be present.
  144.  
  145.      Memory mapping vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_iiii_oooo returns a pointer similar to
  146.      the _b_a_r case above for the first BASE register that decodes PCI I/O
  147.      space.  If no BASE registers on this device decode PCI I/O space, this
  148.      vertex will not be present.
  149.  
  150.      Memory mapping vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_rrrr_oooo_mmmm returns a pointer that can be
  151.      used to initiate PIO access to the PCI space and offset that the system
  152.      expects the PCI device in _s_l_o_t to decode with its Expansion Rom BASE
  153.      address register.  If the card does not advertise an Expansion Rom, then
  154.      this vertex will not be present.
  155.  
  156.      Memory mapping vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_dddd_mmmm_aaaa using as offset the PCI
  157.      address retured by an _PPPP_CCCC_IIII_IIII_OOOO_CCCC_DDDD_MMMM_AAAA_AAAA_LLLL_LLLL_OOOO_CCCC ioctl command will provide an
  158.      appropriate user mapping into the memory allocated for user-initiated
  159.      DMA.  Any mmap request that does not precisely match the PCI address and
  160.      size of an allocated User DMA block will fail.  Each such mmap call needs
  161.      to be matched with a corresponding munmap call before the block is
  162.      returned using _PPPP_CCCC_IIII_IIII_OOOO_CCCC_DDDD_MMMM_AAAA_FFFF_RRRR_EEEE_EEEE or the device is explicitly closed.
  163.  
  164.      Memory mapping vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////_mmmm_eeee_mmmm provides a PIO pointer that
  165.      resolves to any arbitrary location within the PCI MEM address space.
  166.  
  167.      Memory mapping vertex _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////_iiii_oooo provides a PIO pointer that resolves
  168.      to any arbitrary location within the PCI I/O address space.
  169.  
  170. BBBBYYYYTTTTEEEE SSSSWWWWAAAAPPPPPPPPIIIINNNNGGGG IIIISSSSSSSSUUUUEEEESSSS
  171.      MIPS processors and the PCI bus disagree on the relative significance of
  172.      the individual bytes in a multiple-byte data item.  Like many modern RISC
  173.      processors, the MIPS chips prefer to store the most significant byte at
  174.      the first address in memory, with bytes of lower significance following
  175.      it.  The PCI bus follows the convention that the lowest-numbered byte has
  176.      the lowest significance, and it is followed by bytes in increasing
  177.      significance order.
  178.  
  179.      The upshot of this is, hardware implementers have a choice over how to
  180.      interconnect the byte lanes of the PCI bus to the byte lanes of the
  181.      system native bus.  Do they connect them up by bits, so that data items
  182.      the width of the PCI bus come across with the correct values, or do they
  183.      connect them so that the address of each individual byte is invariant?
  184.  
  185.      In a configuration where 32-bit word values are preserved across the
  186.      interface, the host processor must modify addresses for items smaller
  187.      than a 32-bit word. Specifically, to access bytes, the address (or the
  188.      byte offset from an aligned address, which is usually easier) must be
  189.      XORed with 3, and to access 16-bit data, the address must be XORed with
  190.      2.  SGI's PCI support codde gives this byte lane configuration the name
  191.      WORD_VALUES.
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))                                                            PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))
  203.  
  204.  
  205.  
  206.      In a configuration where each byte's address is precisely maintained,
  207.      every data item is at its correct address; and, unless the device is one
  208.      of the rare big-endian PCI devices, the bytes of any multibyte quantity
  209.      are in reversed significance and must be reversed before storing or after
  210.      reading.  SGI's PCI support codde gives this byte lane configuration the
  211.      name BYTE_STREAM.
  212.  
  213.      When this driver is asked for mappings to devices, it provides mappings
  214.      using WORD_VALUES, since it is more efficient to adjust the byte
  215.      addresses of items than to swap bytes when accessing two and four byte
  216.      quantities.
  217.  
  218.      There are currently no interfaces to pciba to request BYTE_STREAM
  219.      mappings.
  220.  
  221. NNNNOOOOTTTTEEEESSSS
  222.      If the system does not support ULI, the _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_iiii_nnnn_tttt_rrrr vertex will
  223.      not be present.
  224.  
  225.      If a boot prom allocates PCI space and sets up a device's BASE registers,
  226.      and the values are not page aligned, pciba is unable to provide direct
  227.      mmap service for those windows, and the corresponding
  228.      _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_bbbb_aaaa_ssss_eeee_////bar, _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_mmmm_eeee_mmmm and _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_iiii_oooo
  229.      verticies will not exist.
  230.  
  231.      Such missing windows can still be accessed, as can any area decoded by a
  232.      BASE register, by the longer method of using a _PPPP_CCCC_IIII_IIII_OOOO_CCCC_GGGG_EEEE_TTTT_BBBB_AAAA_SSSS_EEEE(n) ioctl
  233.      command on the _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////slot_////_cccc_oooo_nnnn_ffff_iiii_gggg vertex to get the content of the
  234.      BASE(n) register.  If this value is odd, mask off the last two bits and
  235.      use the resulting value as the offset for mmap of the _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////_iiii_oooo
  236.      vertex.  If the value was even, mask off the last four bits and use the
  237.      resulting value as the offset for mmap of the _////_hhhh_wwww_////..._////_pppp_cccc_iiii_////_mmmm_eeee_mmmm vertex.
  238.  
  239.    CCCChhhhaaaannnnggggeeeessss ffffrrrroooommmm tttthhhheeee uuuussssrrrrppppcccciiii ddddrrrriiiivvvveeeerrrr
  240.      The most obvious change from the _uuuu_ssss_rrrr_pppp_cccc_iiii driver is that the location of
  241.      nodes in the hardware graph have changed.  A device on an IRIX 6.4 or
  242.      older system that could be accessed using:
  243.  
  244.           _////_hhhh_wwww_////_mmmm_oooo_dddd_uuuu_llll_eeee_////_...._...._...._...._////_pppp_cccc_iiii_////_<<<<_ssss_llll_oooo_tttt_>>>>_////_uuuu_ssss_rrrr_pppp_cccc_iiii
  245.  
  246.      will now be found at:
  247.  
  248.           _////_hhhh_wwww_////_mmmm_oooo_dddd_uuuu_llll_eeee_////_...._...._...._...._////_pppp_cccc_iiii_////_<<<<_ssss_llll_oooo_tttt_>>>>
  249.  
  250.      The _mmmm_eeee_mmmm_3333_2222 and _mmmm_eeee_mmmm_6666_4444 nodes have been renamed _mmmm_eeee_mmmm.
  251.  
  252.      The map size in the usrpci driver was either a big or little window space
  253.      (16 or 128 MB) but the pciba interface checks the size argument to the
  254.      mmap call against the addressable size set up by the card in the Base
  255.      Address Register that defines a particular space.
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))                                                            PPPPCCCCIIIIBBBBAAAA((((7777MMMM))))
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.                                                                         PPPPaaaaggggeeee 5555
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.